<template>
  <div>
    <el-dropdown @command="handleCommand">
      <el-badge :value="count" class="item">
    <i class="el-icon-message-solid" style="font-size: 18px;" />
    </el-badge>
    <el-dropdown-menu slot="dropdown">
      <el-dropdown-item command="/finace/service"><span class="el-dropdown-link">财务-服务费{{ countObj.finance_service_num }}条新消息</span></el-dropdown-item>
      <el-dropdown-item command="/custom/customer"><span class="el-dropdown-link">推荐经理-未完善信息报警数{{ countObj.invite_manager_count }}条新消息</span></el-dropdown-item>
      <el-dropdown-item command="/custom/customer_self"><span class="el-dropdown-link">自注册经理-未完善信息报警数{{ countObj.reg_manager_count }}条新消息</span></el-dropdown-item>
      <el-dropdown-item command="/enterprise/common/license"><span class="el-dropdown-link">联营合作普通合作授权费报警{{ countObj.list_count }}条新消息</span></el-dropdown-item>
      <el-dropdown-item command="/enterprise/common/agreement"><span class="el-dropdown-link">联营合作授权委托协议报警{{ countObj.protocol_count }}条新消息</span></el-dropdown-item>
      <el-dropdown-item command="/enterprise/common/platform"><span class="el-dropdown-link">联营合作普通合作平台服务费报警{{ countObj.ordinary_count }}条新消息</span></el-dropdown-item>
      <el-dropdown-item command="/enterprise/construction/license"><span class="el-dropdown-link">联营合作施工合作授权费列表报警{{ countObj.build_count }}条新消息</span></el-dropdown-item>
      <el-dropdown-item command="/enterprise/construction/platform"><span class="el-dropdown-link">联营合作施工合作平台服务费列表报警{{ countObj.build_service_count }}条新消息</span></el-dropdown-item>
    </el-dropdown-menu>
</el-dropdown>
  </div>
</template>

<script>
import { admin_notice } from '@/api/join'
export default {
  name: 'RuoYiGit',
  data() {
    return {
      url: 'https://gitee.com/y_project/RuoYi-Vue',
      countObj:{
        finance_service_num:0,// 财务-服务费数量
        invite_manager_count:0,// 推荐经理-未完善信息报警数
        reg_manager_count:0,// 自注册经理-未完善信息报警数
        list_count:0,// 联营合作普通合作授权费报警
        protocol_count:0,// 联营合作授权委托协议报警
        ordinary_count:0,// 联营合作普通合作平台服务费报警
        build_count:0,// 联营合作施工合作授权费列表报警
        build_service_count:0,// 联营合作施工合作平台服务费列表报警
      },
      count:0
    }
  },
  created() {
    admin_notice({}).then(res => {
      this.countObj = res.data
      let countNUm = 0;
      const obj = {...this.countObj}
      for (const key in  obj) {
          const element = obj[key];
          countNUm += element
      }
      this.count = countNUm
    })
  },
  methods: {
    goto() {
      window.open(this.url)
    },
    handleCommand(path){
      this.$router.push({path:path})
    }
  }
}
</script>
<style lang="scss"  scoped>
.el-dropdown-link{
  font-size: 16px;
}
</style>